package cl.mt.util.servlet.comun;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import cl.mt.mvc.helper.EmpresaHelper;

/**
 * Servlet implementation class ExisteUsuario
 */
public class ExisteUsuario extends HttpServlet {
	private static final long serialVersionUID = 1L;
	final Logger log = LogManager.getLogger(this.getClass()); 
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ExisteUsuario() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		existeEmpresa(request, response);
	}


	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		existeEmpresa(request, response);
	}

	private void existeEmpresa(HttpServletRequest request,
			HttpServletResponse response) {
		if(request.getParameter("rut")!= null){
			String rut= request.getParameter("rut");
			
			EmpresaHelper empHel = new EmpresaHelper();
			empHel.existeEmpresa(rut);
			log.debug("Servlet usuario");			
		}
		// TODO Auto-generated method stub
		
	}
	boolean existeUsuario(String rut){
		boolean existe = false;
		return existe;
	}

}
